home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
G-Games
/
(c)gb.d64
/
reverse.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
2KB
|
58 lines
5 POKE53280,0:POKE53281,0:POKE54284,33:POKE54286,17:POKE54288,65
6 POKE54281,55:POKE54282,10:DIMS(15)
10 A=RND(-1/TI):B$=" ":V=54279:FORI=0TO15:READS(I):NEXT
15 PRINTCHR$(142)"[147]THE GAME OF 'REVERSE'
20 [153]"IN THIS GAME, C-64 PUTS UP A RANDOM LINE OF
25 PRINT" DIGITS FROM 1 TO 9":PRINT"YOU TRY TO PUT THEM
30 [153]"IN ORDER BY TELLING IT HOW MANY TO REVERSE AT EACH TURN.":[141]3900
40 [153]"LOADFOR EXAMPLE,":[153]" 64 MAY START WITH:":[153]" CONT 9 8 7 6 1 2 3 4 5"
50 [153]"REVERSE 9 FOR:":[153]"CONT 5 4 3 2 1DEF 6 7 8 9"
55 [153]"FINALLY, REVERSE 5":[153]"TO WIN WITH:":[153]"DEF 1 2 3 4 5 6 7 8 9"
60 [153]"IFCLOSEYOU REVERSE ONLY 1, 64 WILL PLAY FOR YOU."
80 [143] PRINT"DO YOU WANT THE":PRINT"SPEEDY VERSION?":GOSUB3500
90 [141]3900
95 [129]I[178]1[164]9:A(I)[178]I:[130]I:X[178]0:SP[178]0:[139]C$[178]"Y"[167]SP[178]1
100 [153]"LOAD REVERSE
120 FORI=1TO9:J=(10-I)*RND(1):A=A(I):A(I)=A(I+J):A(I+J)=A:B(I)=A(I):NEXTI:N=-1
130 N=N+1:PRINT" ";:S=0
135 FORI=1TO9:PRINTA(I)"[157]";:S=S+I*A(I):NEXTI:PRINT
137 PRINTB$:PRINTB$:PRINTB$:PRINTB$"":IFS<285GOTO200
140 :POKEV,0:POKEV+1,0:POKEV+17,0
145 X=0:PRINTX$"THAT TOOK"N"[157] MOVES [157]":IFN>10THENPRINT"[158](YOU COULD DO BETTER)"
150 PRINT"DO YOU WANT TO TRY THE SAME ONE AGAIN?
160 [141]3500:[139]C$[179][177]"Y"[137]100
170 [129]I[178]1[164]9:A(I)[178]B(I):[130]:[153]"LOAD RE-REVERSE "N:N[178][171]1:[137]130
200 [153]"REVERSE HOW MANY? CMDCMDCMD";:[151]V,0:[151]V[170]1,0:[151]V[170]17,0:[139]X[137]2000
210 [141]4000:C[178][197](C$):[139]C[178]0[137]210
215 [139]C[178]1[167]X[178]1::[153]"AIDED":[137]200
220 [153]C$:[129]I[178]1[164]C[173]2:A[178]A(I):A(I)[178]A(C[171]I[170]1):A(C[171]I[170]1)[178]A:[130]:[139]SP[137]130
230 M[178]8:[141]3000:[153][200](B$,2[170]2[172]C)
240 M[178]9[171]C[173]2:[141]3000
250 [141]3000:[129]I[178]1[164]C:[153][200](B$,2[170]3[172]C[173]2[171]I)A(I):[130]:[141]1000
300 [141]3000:[129]I[178]1[164]C:[153][200](B$,1[170]C)A(I)"CMD"[200](B$,C):[130]:[141]1000
400 [141]3000:[129]I[178]1[164]C:[153][200](B$,1[170]C[173]2[170]I)A(I)"CMD"[200](B$,3[172]C[173]2[171]I):[130]
500 [141]1000:[141]3000:[139]C[177]2[167][129]I[178]1[164](C[171]1)[173]2:[153]B$:[130]
510 [137]130
1000 [129]T[178]0[164]200:[130]:[142]
2000 [129]I[178]9[164]2[169][171]1:[139]A(I)[178]I[167][130]I
2010 Y[178]I:[139]A(1)[178]Y[137]2500
2015 C0[178]0:[129]I[178]2[164]Y:[139][182](A(I)[171]A(I[171]1))[178]1[167]C0[178]C0[170]1
2017 [130]I:C2[178]0:J[178]2
2020 [129]I[178]1[164]9:C(I)[178]A(I):[130]I
2030 [129]I[178]1[164]J[173]2:A[178]C(I):C(I)[178]C(J[171]I[170]1):C(J[171]I[170]1)[178]A:[130]I
2040 C1[178]0:[129]I[178]2[164]Y:[139][182](C(I)[171]C(I[171]1))[178]1[167]C1[178]C1[170]1
2050 [130]I:[139]C1[177]C0[167]C0[178]C1:C2[178]J:[137]2070
2060 J[178]J[170]1:[139]J[179][178]Y[137]2020
2070 I[178]C2:[139]C2[137]2500
2100 [129]I[178]2[164]Y:[139]A(I)[179][177]Y[167][130]I
2500 C$[178][196](I):C[178][197](C$):I[178]0:[137]220
3000 [153][200]("",M[170]1);
3010 [151]V[170]17,14:[151]V,S(C):[151]V[170]1,S(C):[142]
3500 [141]4000:[139]C$[178]"Y"[176]C$[178]"N"[167][142]
3510 [137]3500
3900 [153]" HIT A KEY TO CONTINUE
4000 GETC$:IFC$GOTO4000
4010 GETC$:IFC$=""GOTO4010
4020 RETURN
9000 DATA34,75,38,126,43,52,45,198,51,97,57,172,64,188,68,149